{if !empty($serviceList) || !empty($medicineList)}
<div style="height: 22px;" align="right">
    <a id="calculateInsuranceLnk" class="button_bar" href="javascript:calculateInsurance('{$ticketId}')">{translate}Calculate insurance payment{/translate}</a>
</div>
{/if}
<div style="margin-top: 3px;">
	<table id="serviceListTbl" class="grid" cellspacing="0" cellpadding="0" border="0" style="width: 100%">
	    <tbody>
	    {if !empty($serviceList)}
	        <tr><td colspan="8" class="first last group_title">{translate}Service{/translate}</td></tr>
		{foreach from=$serviceList item=item}
		    <tr>
	            <td style="width: 300px;" class="first"><div style="white-space: normal" id="serviceName_{$item.pay_payment_item_id}">{if !empty($item.service_code)}<i>{$item.service_code}</i> {/if}{$item.service_name}</div></td>
		        <td style="width: 80px;" class="field-number">{$item.unit}</td>
				<td style="width: 75px;" class="field-number">{$item.quantity}</td>
				<td style="width: 100px;" class="field-number">{$item.unit_price_formatted}</td>                                             
				<td style="width: 90px;" class="field-number">{$item.original_price_formatted}</td>
				<td style="width: 90px;" class="field-number">{$item.insurance_price_formatted}</td>
				<td style="width: 100px;" class="field-number">{$item.patient_price_formatted}</td>
				<td class='last action'>
				   {if $item.collected == 0}
				   <div>              
				       <div id="{$item.pay_payment_item_id}_btn" >
				           <a href="javascript:deleteServiceItem({$item.pay_payment_item_id})"  title="{translate}Delete{/translate}">
				               <img src="../images/remove_small_16x16.png" alt="{translate}Delete{/translate}"></img> 
				           </a>
				       </div>
				       <div id="{$item.pay_payment_item_id}_loader" style="display: none;">
				           <img  src="../images/ajax-loader-small.gif">
				       </div>
				   </div>
				   {/if}
				</td>     
		    </tr>
		{/foreach}
		{/if}
	             {if !empty($medicineList)}
	                 <tr><td colspan="8" class="first last group_title">{translate}Medicine{/translate}</td></tr>
	             {foreach from=$medicineList item=item}
	                 <tr>
	                     <td style="width: 300px;" class="first"><div style="white-space: normal" id="serviceName_{$item.pay_payment_item_id}">{$item.service_name}</div></td>
	                     <td style="width: 80px;" class="field-number">{$item.unit}</td>
	                     <td style="width: 75px;" class="field-number">{$item.quantity}</td>
	                     <td style="width: 100px;" class="field-number">{$item.unit_price_formatted}</td>                                             
	                     <td style="width: 90px;" class="field-number">{$item.original_price_formatted}</td>
	                     <td style="width: 90px;" class="field-number">{$item.insurance_price_formatted}</td>
	                     <td style="width: 100px;" class="field-number">{$item.patient_price_formatted}</td>
	                     <td class='last action'>
	                       {if $item.collected == 0}
	                        <div>              
	                            <div id="{$item.pay_payment_item_id}_btn" >
	                                <a href="javascript:deleteMedicineItem({$item.pay_payment_item_id})"  title="{translate}Delete{/translate}">
	                                    <img src="../images/remove_small_16x16.png" alt="{translate}Delete{/translate}"></img> 
	                                </a>
	                            </div>
	                            <div id="{$item.pay_payment_item_id}_loader" style="display: none;">
	                                <img  src="../images/ajax-loader-small.gif">
	                            </div>
	                        </div>
	                        {/if}
	                     </td>     
	                 </tr>
	             {/foreach}
	             {/if}				
		{if empty($serviceList) && empty($medicineList)}
		    <tr><td class="first last">{translate}The patient has no information on payment items{/translate}</td></tr>
		{/if}
		</tbody>
	</table>
</div>